const { generateBody, serverErr } = require('@utils/tools');

const prefix = require('./module.prefix');

const { Unauthorized } = require('./http.status');

module.exports = {
  userExistsErr: serverErr(prefix.user + '04', '用户已存在'),

  userRegisterErr: serverErr(prefix.user + '08', '用户注册服务异常'),

  userNotRegisterErr: serverErr(prefix.user + '05', '用户未注册'),

  userPasswordMatchErr: serverErr(prefix.user + '06', '用户名密码不匹配'),

  userLoginErr: serverErr(prefix.user + '09', '用户登录服务异常'),

  userUpdatePwdErr: serverErr(prefix.user + '07', '修改密码失败'),

  tokenExpiredErr: generateBody({
    code: prefix.auth + '01',
    message: 'token失效',
    status: Unauthorized,
  }),

  tokenInvalidErr: generateBody({
    code: prefix.auth + '02',
    message: '无效token',
    status: Unauthorized,
  }),

  notAdminPermission: generateBody({
    code: prefix.auth + '03',
    message: '没有管理员权限',
    status: Unauthorized,
  }),

  goodsUnSupport: serverErr(prefix.goods + '01', '文件格式不支持'),

  goodsUploadErr: serverErr(prefix.goods + '02', '文件上传失败'),

  goodsRemoveErr: serverErr(prefix.goods + '03', '商品下架失败'),

  goodsRestoreErr: serverErr(prefix.goods + '04', '商品上架失败'),

  goodsUpdateErr: serverErr(prefix.goods + '05', '商品更新失败'),

  goodsGetListErr: serverErr(prefix.goods + '06', '商品获取失败'),

  goodsAddListErr: serverErr(prefix.goods + '07', '新增商品失败'),

  cartAddErr: serverErr(prefix.cart + '01', '商品未找到'),

  cartUpdateErr: serverErr(prefix.cart + '02', '更新失败'),

  cartRemoveErr: serverErr(prefix.cart + '03', '删除失败'),

  cartBulkUpdateErr: serverErr(prefix.cart + '04', '批量更新失败'),

  cartGetListErr: serverErr(prefix.cart + '05', '购物车获取失败'),

  addrSetDefaultErr: serverErr(prefix.address + '01', '设置默认地址失败'),

  addrGetListErr: serverErr(prefix.address + '02', '获取地址失败'),

  addrUpdateErr: serverErr(prefix.address + '03', '更新地址失败'),

  addrAddErr: serverErr(prefix.address + '04', '新增地址失败'),
};
